<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>6、类式组件</title>
</head>
<body>
    <div id="test"></div>

    <script type="text/javascript" src="../js/react.development.js"></script>
    <script type="text/javascript" src="../js/react-dom.development.js"></script>
    <script type="text/javascript" src="../js/babel.min.js"></script>
    <script type="text/babel">
        class MyComponent extends React.Component{
            // 放在原型对象上，供实例对象调用，实例对象是React创建出来的，因此render方法也是React调用的
            render(){
                return <h2>我是用类定义的组件(适用于复杂组件)</h2>
            }
        }

        ReactDOM.render(<MyComponent/>, document.getElementById('test'))
    </script>
</body>
</html>